home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- File: CScripter.h
-
- Contains: C++ class definition.
-
- Written by: Sue Dumont
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- ------------------------------------------------------------------------------*/
-
- #ifndef _CSCRIPTER_
- #define _CSCRIPTER_
-
-
- // --- OpenDoc Includes ---
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- #ifndef SOM_ODDesc_xh
- #include <ODDesc.xh>
- #endif
-
- // -- OpenDoc Utilities --
-
- #ifndef _ITEXT_
- #include <IText.h>
- #endif
-
- #ifndef _ODDEBUG_
- #include <ODDebug.h>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- // -- Macintosh Includes --
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
-
-
- //------------------------------------------------------------------------------
- // CScripter Class Definition
- //------------------------------------------------------------------------------
-
- class CScripter
- {
- public:
- CScripter();
- ~CScripter();
-
- ODScriptingConnection OpenScriptingComponent();
-
- void ReleaseScriptData();
- void SetScriptDirty();
- ODBoolean IsDirty();
- ODDesc* GetScriptSourceDesc();
- void SetScriptSourceDesc(ODDesc* source);
- ODBoolean GetScriptSourceBA(ODPlatformType wantType, ODByteArray* data);
- void SetScriptSourceBA(ODPlatformType type, ODByteArray* source);
-
- ODOSAID GetOSAScriptID();
- void SetOSAScriptID(ODOSAID scriptID);
-
- ODOSAID GetScriptResult();
-
- void DoCompile();
- void DoDecompile();
- void DoRun();
-
- void GetResultAsODDesc(ODDescType type, ODDesc* result);
- ODISOStr GetResultAsText(Environment* ev);
-
- void GetError(ODDescType kind, ODDescType type, ODDesc* result);
- ODISOStr GetErrorMessage(Environment* ev);
- ODISOStr GetErrorAppName(Environment* ev);
-
- private:
- ODScriptingConnection fComponent; // OSA component connection
- AEDesc* fSource; // Current script source
- ODOSAID fScriptID; // Current script object id
- ODOSAID fResultValue; // Last returned result
- ODBoolean fScriptDirty; // Is script dirty?
- };
-
-
- //-------------------------------------------------------------------------
- // Inline methods
- //-------------------------------------------------------------------------
-
- inline ODOSAID CScripter::GetScriptResult()
- {
- return this->fResultValue;
- }
-
- inline ODOSAID CScripter::GetOSAScriptID()
- {
- return this->fScriptID;
- }
-
- inline ODBoolean CScripter::IsDirty()
- {
- return this->fScriptDirty;
- }
-
- inline void CScripter::SetScriptDirty()
- {
- this->fScriptDirty = kODTrue;
- }
-
-
- #endif